package com.orphan.marketFront.controller;


import com.orphan.marketFront.po.Goods;
import com.orphan.marketFront.service.IGoodsService;
import com.orphan.marketFront.util.ResultVO;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用作在主菜单显示商品 前端控制器
 * </p>
 *
 * @author orphan
 * @since 2021-07-13
 */
@RestController
@RequestMapping("/goods")
@CrossOrigin
public class GoodsController {
    @Resource
    IGoodsService goodsService;

    @GetMapping("/getAllGoodsPhone")
    public ResultVO getAllGoodsPhone(){
        List<Goods> allGoodsPhone = goodsService.getAllGoodsPhone();
        return ResultVO.success(allGoodsPhone);
    }

    @GetMapping("/getAllGoodsTV")
    public ResultVO getAllGoodsTV(){
        List<Goods> allGoodsTV = goodsService.getAllGoodsTV();
        return ResultVO.success(allGoodsTV);
    }

    @GetMapping("/getAllGoods")
    public ResultVO getAllGoods(){
        List<Goods> allGoods = goodsService.getAllGoods();
        return ResultVO.success(allGoods);
    }
}
